//引入react核心库
import React from 'react';
import {
  BrowserRouter as Router,
  Switch,
} from 'react-router-dom'
import FrontendAuth from './FrontendAuth'
import routes from './route'
//引入ReactDom
import ReactDOM from 'react-dom';

import './index.css';
//引入App组件
import reportWebVitals from './reportWebVitals';
//渲染App到页面
class Index extends React.PureComponent {
  render () {
    return (
      <Router>
        {/* 含多个路由时使用switch组件进行包裹，实现单一匹配 */}
        <Switch>
          {/* /路由守卫 */}
          <FrontendAuth routerConfig={routes}></FrontendAuth>
        </Switch>
      </Router>
    )
  }
}
ReactDOM.render(
  <React.StrictMode>
    <Index/>
  </React.StrictMode>,
  document.getElementById('root')
);
reportWebVitals();
